import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Index from "../views/Index.vue";
import Home from '../views/Home.vue'

const routes: Array<RouteRecordRaw> = [
  // {
  //   path: '/',
  //   redirect:'/index',
  // },
  {
    path: '/',
    name: 'index',
    component: Index
  },
  //首页路由页面
  {
    path: '/home',
    name: 'home',
    component:Home,
    //设置二级路由
    children: [
      {
        path: '/echarts',
        name: 'echarts',
        component: () => import('../views/HomeChildren/EchartsView.vue'),
        meta: {
          title: "数据展示"
        }
      },
      {
        path: '/permissionlist',
        name: 'permissionlist',
        component: () => import('../views/HomeChildren/PermissionList.vue'),
        meta: {
          title: "权限列表"
        }
      },
      {
        path: "/user",
        name: "user",
        component: () => import("../views/HomeChildren/Userone.vue"),
        meta: {
          title: "住户信息"
        },
        children: [
          {
            path: '/userlist',
            name: 'userlist',
            component: () => import('../views/HomeChildren/Userlist.vue'),
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户列表"
            }
          },
          {
            path: '/userupdate',
            name: 'userupdate',
            component: () => import('../views/HomeChildren/Userupdate.vue'),
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户信息修改"
            }
          },
        ]
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
